<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport"
	content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="renderer" content="webkit">
<title>添加产品分类</title>
<link rel="stylesheet" href="../../css/pintuer.css">
<link rel="stylesheet" href="../../css/admin.css">
<script src="../../js/jquery.js"></script>
<script src="../../js/pintuer.js"></script>
<script src="../../js/md5.js"></script>
</head>
<body>
	<div class="panel admin-panel">
		<div class="panel-head" id="add">
			<strong><span class="icon-pencil-square-o"></span>增加内容</strong>
		</div>
		<div class="body-content">
			<form method="post" class="form-x" action="">
				<div class="form-group">
					<div class="label">
						<label>分类名称：</label>
					</div>
					<div class="field">
						<input type="text" id="typeName" class="input w50" maxlength="16"
							value="" name="typeName" data-validate="required:请输入分类名称" />
						<div class="tips"></div>
					</div>
				</div>
				<div class="form-group">
					<div class="label">
						<label>状态：</label>
					</div>
					<div class="field">
						<select class="input w50" id="status">
							<option value="1" selected="selected">上架</option>
							<option value="2">下架</option>
							<option value="3">删除</option>
						</select>
					</div>
				</div>
				<div class="form-group">
					<div class="label">
						<label></label>
					</div>
					<div class="field">
						<button class="button bg-main icon-check-square-o" id="submit"
							type="button">提交</button>
					</div>
				</div>
			</form>
		</div>
	</div>
</body>
<script type="text/javascript">
	$(function() {
		$("#submit").click(function() {
			var name = $("#typeName").val();
			var status = $("#status").val();
			if (name == null || name == '') {
				alert("登录名不能为空！");
				return;
			}
			$.ajax({
				type : "POST",
				url : host_url + "product-type/addProuctType",
				xhrFields : {
					withCredentials : true
				},
				data : {
					name : name,
					status : status
				},
				success : function(data) {
					if(data.code==0){
						location.href = "./list.html";
					}else{
						alert(data.msg);
					}
					
				}
			});
		});
	})
</script>
</html>